/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.click.app.model;

import java.io.Serializable;
import java.util.Date;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;
import javax.persistence.Temporal;

/**
 *
 * @author ariel
 */
@Entity
@Table(name = "asistance_controls")
public class AsistanceControl implements Serializable {

    private static final long serialVersionUID = 1L;
    private Long id;
    private Date date;
    private Boolean halfDay;
    private Employee employee;

    public AsistanceControl() {
        date = new Date();
    }

    public AsistanceControl(Long id) {
        this.id = id;
    }

    public AsistanceControl(Date date, Boolean halfDay, Employee employee) {
        this.date = date;
        this.halfDay = halfDay;
        this.employee = employee;
    }

    @Id
    @GeneratedValue(strategy = GenerationType.SEQUENCE)
    @Column(name = "id_asistance_control")
    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    @Column(nullable = false)
    @Temporal(javax.persistence.TemporalType.DATE)
    public Date getDate() {
        return date;
    }

    public void setDate(Date date) {
        this.date = date;
    }

    @Column(name = "half_day")
    public Boolean getHalfDay() {
        return halfDay;
    }

    public void setHalfDay(Boolean halfDay) {
        this.halfDay = halfDay;
    }

    @JoinColumn(name = "id_employee", referencedColumnName = "id_user")
    @ManyToOne(optional = false)
    public Employee getEmployee() {
        return employee;
    }

    public void setEmployee(Employee employee) {
        this.employee = employee;
    }
}
